<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
  
    <input type="hidden" id="tableNameId" />
 <div style="height: 30px;padding: 0;margin: 0;border: 1opx " id="partPage">
	 <!-- <div style="float: left;height:40px;" class="mp">
		<input type="text" class="form-control" id="searchBomBillParamsId" 
		class="mp" style="width: 200px;overflow: hidden;" placeholder="请输入清单名">
	</div> -->
	<div style="float: left;margin-left: 10px;padding-top: 3px;" class="mp">
		<button type="button" class="btn btn-info" id="search" class="mp">查询</button>
	</div> 
	<div style="float: left;margin-left: 10px;height:40px;line-height: 40px;padding-top: 3px;" class="mp">
		<button type="button" class="btn btn-info" id="addModalId" 
			data-toggle="modal" data-target="#addModal" class="mp">新增</button>
	</div>
	 <div style="float: left;margin-left: 10px;height:40px;line-height: 40px;padding-top: 3px;"class="mp">
		<button type="button" class="btn btn-danger" id="deleteId" >删除</button>
	</div> 
	 <div style="float: left;margin-left: 10px;height:40px;line-height: 40px;padding-top: 3px;"class="mp">
		<button type="button" class="btn btn-danger" id="updateId" >修改</button>
	</div> 
</div>
<div style="width: 100%;">
	<table id="gridTableId" class="table table-bordered">
		<thead>
			<tr id="title_id">
			</tr>
		</thead>
		<tbody id="info_tbody_id">
			
		</tbody>
	</table>
	<nav aria-label="Page navigation example">
		<ul class="pagination" id="pagination">
						  
	   </ul> 
	</nav> 
</div>
<div id="loadModalAreaId">

</div>
<script type="text/javascript">
(function(){
	var basePath = "${pageContext.request.contextPath}";
	$("#addModalId").on("click",function(){
		$(this).loadMoal({
			momdalId: "addModal",
			loadModelAreaId: "loadModalAreaId",
			modalPageUrl: basePath + "/web/table_info_add.jsp",
			isAdd: true,
			success:function(obj){
				
			}
		});
	});
	$("#updateId").on("click",function(){
		$(this).loadMoal({
			momdalId: "addModal",
			loadModelAreaId: "loadModalAreaId",
			modalPageUrl: basePath + "/web/table_info_add.jsp",
			formBodyId: "addBodyId",
			isAdd: false,
			tbodyId: "info_tbody_id",
			success:function(obj){
				
			}
		});
	});
	$("#deleteId").on("click",function(){
		$(this).deleteModel({
			tbodyId: "info_tbody_id",
			tableNameId: "tableNameId",
			url: basePath + "/dynamicForm/dynamicFormAction.do?method=deleteModel",
			backFunction: function(obj){
				
			}
		});
	});
})();
/*
(function(){
	var basePath = "${pageContext.request.contextPath}";
	function loadMoal(data){
		$("#loadModalAreaId").html("");
		$("#loadModalAreaId").load(basePath+"/web/table_info_add.jsp",{},function(){
			$("#addModalId").on("show.bs.modal",function(event){
				
			});
			$("#addModal").modal("show");
		});
		 
	}
	function loadGrid(event,data){
		if(typeof(data)=="undefined"){
			data={};
		}
		data.start=1;
		var url = basePath + "/dynamicForm/dynamicFormAction.do?method=getList";
		$("#gridTableId").wgrid({
			table_title:"title_id",
			tbodyId:"info_tbody_id",
			pagination:"pagination",
			url:url,
			checkbox:true,
			checkboxId: "add_checkbox",
			data:data,
			success:function(){
			//	changeUserState();
			}
		});
	}
	function loadGridTitle(data,obj){
		var url = basePath + "/dynamicForm/dynamicFormAction.do?method=getTableInfoByEnName";
		$.post(url,data,function(dataJson){
			$("#title_id").html("");
			$("#title_id").append('<th style="width:100px; ">编号</th>');
			$("#title_id").append('<th  width="50" fname="companyNameCheckBox"><input id="add_checkbox" type="checkbox"></th>');
			var jsonT = jQuery.parseJSON(dataJson);
			var json = jQuery.parseJSON(jsonT.table_info);
			for(var i = 0;i < json.length;i++){
				$("#title_id").append('<th fname="'+json[i].column+'">'+json[i].name+'</th>');
			}
			$("#title_id").append('<th fname="showTime">创建时间</th>');
			
			var json = {
					'start': 0,
					'limit': 20
			};
			var dataGrid = {
					"name": $(obj).attr("table_name"),
					"jsonStr":JSON.stringify(json)
			};
			$("#tableNameId").val($(obj).attr("table_name"));
			$("#tableNameId").data("formData",jsonT);
			$("#tableNameId").data("tableNameData",$(obj).attr("table_name"));
			loadGrid(event,dataGrid);
		});
	}
	$("#addModalId").on("click",function(){
		loadMoal({});
	});
	$.fn.extend({
		loadGridTitle: function(obj){
			loadGridTitle({"table_en_name":$(obj).attr("table_name")},obj);
		},
		loadGrid:function(data){
			loadGrid(event,data);
		}
	});
})();*/
</script>